<?php

namespace App\Http\Controllers\Customer;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use ValiDate;
use App\Facades\Services\CustomerInfoService;

class CustomerInfoController extends Controller
{
	public function createInfo(Request $request){

		$rules = [
			'header' => 'required',
			'name' => 'required',
			'sex' => 'required'
		];

		ValiDate::validate($request,$rules);

		$data = $request->all();

		CustomerInfoService::createInfo($data);

		return formatJsonResponse();
	}

	public function getInfo(Request $request){

		return formatJsonResponse(CustomerInfoService::getInfo());
	}

	public function updateInfo(Request $request){

		$rules = [
			'header' => 'required',
			'name' => 'required',
			'sex' => 'required'
		];

		ValiDate::validate($request,$rules);

		$data = $request->all();

		return formatJsonResponse(CustomerInfoService::updateInfo($data));
	}
}
